home *** CD-ROM | disk | FTP | other *** search
- ; This is a planar --> chunky --> planar routine used for
- ; MakeNewImg() function.
-
- xdef _mkImg
-
- section code
- _mkImg:
- ;A1 - start of a source bitplane
- ;A2 - start of a destination bitplane
- ;A3 - palette list
- ;
- ;D4 - size of one bit plane
- ;D5 - source depth
- ;D6 - destination depth
- ;
- ;internals:
- ;A1 - current position on a source bitplane
- ;A2 - current pos. on a dest. bitplane
- ;D3 - end of the first bitplane
- ;D7 - color palete byte
- ;also reserved are: A0, D0, D1
-
- move.l a1,d3 ;end of the first bitplane -->d3
- add.l d4,d3
-
- st1:
- moveq #7,d0 ;bit position (goes from 7 to 0)
-
- st2:
- clr d7
- clr d1
-
-
- source: ; this computes a chunky byte from source planes
- bsr getsrcbyte ; fills A0 with D1-th plane
- btst d0,(a0)
- beq set0
- bset d1,d7
- set0:
- addq.w #1,d1
- cmp.w d1,d5
- bgt source
-
-
- lsl.w #2,d7 ;*4 for palette has long entries
- move.l $0(a3,d7.w),d7 ;gets the new color
- clr d1
-
- dest: ;this modifies planar planes into the new color
- bsr getdestbyte
- btst d1,d7
- beq dest0
- bset d0,(a0)
- dest0:
- addq.w #1,d1
- cmp.w d1,d6
- bgt dest
-
-
- subq.b #1,d0 ;still in the same byte (7 to 0)? loop!
- bge st2
-
- addq #1,a1
- addq #1,a2
- cmp.l a1,d3
- bgt st1 ;loop until end of planes
-
- rts
-
- getsrcbyte:
- tst.b d1
- beq srcyes
- add.l d4,a0
- rts
- srcyes:
- move.l a1,a0
- rts
-
- getdestbyte:
- tst.b d1
- beq destyes
- add.l d4,a0
- rts
- destyes:
- move.l a2,a0
- rts
-
- end
-
-
-